<@override name="link">
<link href="${base}/resources/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
</@override>
<@override name="body">
    <body class="gray-bg">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-title">
                    <h5>部门管理</h5>
                    <div class="ibox-tools">
                        <a href="javascript:;" class="dropdown-toggle" title="添加部门">
                            <i class="fa fa-arrows"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <form action="index.html">
                        <div class="row">
                            <div class="col-sm-9 m-b-xs"></div>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input type="hidden" name="pageNumber" id="pageNumber" value="${pageable.pageNumber}">
                                    <input type="hidden" name="pageSize" id="pageSize" value="${pageable.pageSize}">
                                    <input type="text" placeholder="权限的名称" name="key" value="<#if key??>${key}</#if>" class="input-sm form-control">
                                    <input type="hidden" name="check" value="<#if check??>${check}</#if>">
                                    <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
                                    </span>
                                </div>
                            </div>
                        </div>
                    </form>
                    <table class="table table-striped">
                        <thead>
                            <tr>
                                <#if checkbox??>
                                    <td></td>
                                </#if>
                                <td>编码</td>
                                <td>名称</td>
                                <td>说明</td>
                                <td>上级部门</td>
                                <td>操作</td>
                            </tr>
                        </thead>
                        <tbody>
                            <#list page.contents as department>
                                <tr>
                                    <#if check??>
                                        <td>
                                            <div class="<#if check=='ok'>radio<#else>checkbox</#if> i-checks">
                                                <input type="<#if check=='ok'>radio<#else>checkbox</#if>" name="id" data-id="${department.id}" data-name="${department.name}">
                                            </div>
                                        </td>
                                    </#if>
                                    <td>${department.id}</td>
                                    <td>${department.name}</td>
                                    <td>${department.depDesc}</td>
                                    <td>
                                        <#if department.parent??>
                                            <span class="label label-primary">
                                                ${department.parent.name}
                                            </span>
                                        <#else>
                                            暂无上级
                                        </#if>
                                    </td>
                                    <td>
                                        <a href="javascript:;" class="btn btn-xs btn-primary" data-id="${department.id}" title="添加子集">
                                            <i class="fa fa-arrows"></i>
                                        </a>
                                        <a href="javascript:;" class="btn btn-xs btn-primary" data-id="${department.id}" title="删除部门">
                                            <i class="fa fa-times-circle"></i>
                                        </a>
                                    </td>
                                </tr>
                            </#list>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    <!-- 添加部门的弹出框 -->
        <div class="modal inmodal" id="addDepartment" tabindex="1" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content animated fadeInDown">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">
                            <span aria-hidden="true">&times;</span>
                            <span class="sr-only">Close</span>
                        </button>
                        <i class="fa fa-user-md modal-icon"></i>
                        <h4 class="modal-title">添加部门</h4>
                    </div>
                    <form action="submit" id="submitForm" method="post" class="form-horizontal">
                        <div class="modal-body">
                            <div class="form-group">
                                <input type="hidden" id="parentId">
                                <label for="departmentName" class="col-sm-3 control-label">
                                    岗位名称
                                </label>
                                <div class="col-sm-8">
                                    <input type="text" class="form-control" name="name" id="departmentName"/>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label for="content" class="col-sm-3 control-label">
                                    岗位说明
                                </label>
                                <div class="col-sm-8">
                                    <textarea name="content" id="content" class="form-control" cols="30" rows="4"></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </body>
</@override>
<@override name="script">
    <script type="text/javascript" src="${base}/resources/admin/js/plugins/iCheck/icheck.min.js"></script>
    <script type="text/javascript" src="${base}/resources/admin/js/department.js"></script>
    <script type="text/javascript">
        Department.submit();
        Common.checkbox();
    </script>
</@override>
<@extends name="../base/main.html"/>